home *** CD-ROM | disk | FTP | other *** search
/ IRIX Base Documentation 2001 May / SGI IRIX Base Documentation 2001 May.iso / usr / share / catman / u_man / cat3 / Tcl / open.z / open
Encoding:
Text File  |  1998-10-30  |  6.1 KB  |  133 lines

  1.  
  2.  
  3.  
  4. ooooppppeeeennnn((((3333TTTTccccllll))))                                                          ooooppppeeeennnn((((3333TTTTccccllll))))
  5.  
  6.  
  7.  
  8. NNNNAAAAMMMMEEEE
  9.      open - Open a file
  10.  
  11. SSSSYYYYNNNNOOOOPPPPSSSSIIIISSSS
  12.      ooooppppeeeennnn _f_i_l_e_N_a_m_e ?_a_c_c_e_s_s? ?_p_e_r_m_i_s_s_i_o_n_s?                                     |
  13.  
  14.  
  15. DDDDEEEESSSSCCCCRRRRIIIIPPPPTTTTIIIIOOOONNNN
  16.      This command opens a file and returns an identifier that may be used in
  17.      future invocations of commands like rrrreeeeaaaadddd, ppppuuuuttttssss, and cccclllloooosssseeee.  _F_i_l_e_N_a_m_e
  18.      gives the name of the file to open; if it starts with a tilde then tilde
  19.      substitution is performed as described for TTTTccccllll____TTTTiiiillllddddeeeeSSSSuuuubbbbsssstttt.  If the first
  20.      character of _f_i_l_e_N_a_m_e is ``|'' then the remaining characters of _f_i_l_e_N_a_m_e
  21.      are treated as a command pipeline to invoke, in the same style as for
  22.      eeeexxxxeeeecccc.  In this case, the identifier returned by ooooppppeeeennnn may be used to write
  23.      to the command's input pipe or read from its output pipe.
  24.  
  25.      The _a_c_c_e_s_s argument indicates the way in which the file (or command
  26.      pipeline) is to be accessed.  It may take two forms, either a string in  |
  27.      the form that would be passed to the ffffooooppppeeeennnn library procedure or a list of|
  28.      POSIX access flags.  It defaults to ``rrrr''.  In the first form _a_c_c_e_s_s may |
  29.      have any of the following values:
  30.  
  31.      rrrr              Open the file for reading only; the file must already
  32.                     exist.
  33.  
  34.      rrrr++++             Open the file for both reading and writing; the file must
  35.                     already exist.
  36.  
  37.      wwww              Open the file for writing only.  Truncate it if it exists.
  38.                     If it doesn't exist, create a new file.
  39.  
  40.      wwww++++             Open the file for reading and writing.  Truncate it if it
  41.                     exists.  If it doesn't exist, create a new file.
  42.  
  43.      aaaa              Open the file for writing only.  The file must already
  44.                     exist, and the file is positioned so that new data is
  45.                     appended to the file.
  46.  
  47.      aaaa++++             Open the file for reading and writing.  If the file
  48.                     doesn't exist, create a new empty file.  Set the initial
  49.                     access position  to the end of the file.
  50.  
  51.      In the second form, _a_c_c_e_s_s consists of a list of any of the following    |
  52.      flags, all of which have the standard POSIX meanings.  One of the flags  |
  53.      must be either RRRRDDDDOOOONNNNLLLLYYYY, WWWWRRRROOOONNNNLLLLYYYY or RRRRDDDDWWWWRRRR.
  54.  
  55.      RRRRDDDDOOOONNNNLLLLYYYY         Open the file for reading only.                           |
  56.  
  57.      WWWWRRRROOOONNNNLLLLYYYY         Open the file for writing only.                           |
  58.  
  59.  
  60.  
  61.  
  62.  
  63.                                                                         PPPPaaaaggggeeee 1111
  64.  
  65.  
  66.  
  67.  
  68.  
  69.  
  70. ooooppppeeeennnn((((3333TTTTccccllll))))                                                          ooooppppeeeennnn((((3333TTTTccccllll))))
  71.  
  72.  
  73.  
  74.      RRRRDDDDWWWWRRRR           Open the file for both reading and writing.               |
  75.  
  76.      AAAAPPPPPPPPEEEENNNNDDDD         Set the file pointer to the end of the file prior to each |
  77.                     write.
  78.  
  79.      CCCCRRRREEEEAAAATTTT          Create the file if it doesn't already exist (without this |
  80.                     flag it is an error for the file not to exist).
  81.  
  82.      EEEEXXXXCCCCLLLL           If CCCCRRRREEEEAAAATTTT is also specified, an error is returned if the   |
  83.                     file already exists.
  84.  
  85.      NNNNOOOOCCCCTTTTTTTTYYYY         If the file is a terminal device, this flag prevents the  |
  86.                     file from becoming the controlling terminal of the        |
  87.                     process.
  88.  
  89.      NNNNOOOONNNNBBBBLLLLOOOOCCCCKKKK       Prevents the process from blocking while opening the file.|
  90.                     For details refer to your system documentation on the ooooppppeeeennnn|
  91.                     system call's OOOO____NNNNOOOONNNNBBBBLLLLOOOOCCCCKKKK flag.
  92.  
  93.      TTTTRRRRUUUUNNNNCCCC          If the file exists it is truncated to zero length.        |
  94.  
  95.      If a new file is created as part of opening it, _p_e_r_m_i_s_s_i_o_n_s (an integer) |
  96.      is used to set the permissions for the new file in conjunction with the  |
  97.      process's file mode creation mask.  _P_e_r_m_i_s_s_i_o_n_s defaults to 0666.
  98.  
  99.      If a file is opened for both reading and writing then sssseeeeeeeekkkk must be
  100.      invoked between a read and a write, or vice versa (this restriction does
  101.      not apply to command pipelines opened with ooooppppeeeennnn).  When _f_i_l_e_N_a_m_e
  102.      specifies a command pipeline and a write-only access is used, then
  103.      standard output from the pipeline is directed to the current standard
  104.      output unless overridden by the command.  When _f_i_l_e_N_a_m_e specifies a
  105.      command pipeline and a read-only access is used, then standard input from
  106.      the pipeline is taken from the current standard input unless overridden
  107.      by the command.
  108.  
  109.  
  110. KKKKEEEEYYYYWWWWOOOORRRRDDDDSSSS
  111.      access mode, append, controlling terminal, create, file, non-blocking,
  112.      open, permissions, pipeline, process
  113.  
  114.  
  115.  
  116.  
  117.  
  118.  
  119.  
  120.  
  121.  
  122.  
  123.  
  124.  
  125.  
  126.  
  127.  
  128.  
  129.                                                                         PPPPaaaaggggeeee 2222
  130.  
  131.  
  132.  
  133.